package c_processPkg

import (
	"Infinichat_mixed/entity"
	"encoding/json"
	"fmt"
)

func outputGroupMes(mes *entity.Message) {
	var smsMes entity.SmsMes
	err := json.Unmarshal([]byte(mes.Data), &smsMes)
	if err != nil {
		fmt.Println("error:", err)
		return
	}
	info := fmt.Sprintf("用户 id: %d, 昵称: %s, 广播说: %s", smsMes.User.Model.ID, smsMes.User.Nickname, smsMes.Content)
	fmt.Println(info)
	fmt.Println()
}

func outputP2PMes(mes *entity.Message) {
	var smsOneMes entity.P2PMsg
	err := json.Unmarshal([]byte(mes.Data), &smsOneMes)
	if err != nil {
		fmt.Println("error:", err)
		return
	}
	info := fmt.Sprintf("用户 id: %d 私聊你: %s", smsOneMes.SendId, smsOneMes.Content)
	fmt.Println(info)
}
